<template>
  <h1 ref="message">{{ msg }}</h1>
  <button @click="showMsg">点击我</button>
  <Msg ref="msg"></Msg>
  <!-- 点击按钮过后 打印h1标签内的内容 -->
</template>

<script>
import Msg from './components/Msg.vue'

export default {
  name: 'App',
  data(){
    return{
      msg:'你好啊'
    }
  },
  components:{
      Msg
  },
  methods:{
    showMsg(){
      //document.getElementById();
      console.log(this.$refs.message);
      console.log(this.$refs.msg);
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
